package com.nhii.appframe.mvp.model;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.base.my.BaseEntity;
import com.jess.arms.base.my.BaseEntityEmpty;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.nhii.appframe.app.service.AppApi;
import com.nhii.appframe.mvp.contract.LoginContract;


import javax.inject.Inject;

import io.reactivex.Observable;


/**
 * ================================================
 * author : Alex
 * e-mail : xys9786@outlook.com
 * version: 1.0
 * Description:
 * <p>
 * Created by MVPArmsTemplate on 05/05/2020 08:03
 * ================================================
 */
@ActivityScope
public class LoginModel extends BaseModel implements LoginContract.Model {
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;

    @Inject
    public LoginModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<BaseEntity<BaseEntityEmpty>> setLogin(String name, String pwd) {
        return mRepositoryManager.obtainRetrofitService(AppApi.class).setLogin(name,pwd);
    }

}